﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Commerce/Views/Shared/Backend.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%: "Shippings".Localize()%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3 class="title">
        <%:"Shippings".Localize()%></h3>
    <div class="command clearfix">
        <a class="button shipping-add" href="#shipping-dialog">
            <%:"Create new Shipping".Localize()%></a>
    </div>
    <div class="table-container">
        <table>
            <thead>
                <tr>
                    <th>
                        <%:"Name".Localize() %>
                    </th>
                    <th class="action">
                        <%:"Shipping Rules".Localize() %>
                    </th>
                    <th class="action">
                        <%:"Edit".Localize() %>
                    </th>
                    <th class="action">
                        <%:"Delete".Localize() %>
                    </th>
                </tr>
            </thead>
            <tbody id="shipping-container">
            </tbody>
        </table>
    </div>
    <!--template-->
    <table id="shipping-row" class="hide">
        <tbody>
            <tr class="template">
                <td>
                </td>
                <td class="action">
                </td>
                <td class="action">
                    <a class="o-icon edit" href="#shipping-dialog">
                        <%:"Edit".Localize() %></a>
                </td>
                <td class="action">
                    <form action='<%= ViewData["delete_action"] %>' method="post">
                    <a class="o-icon delete delete-link" message='<%= "Are you sure you want to delete this shipping?".Localize() %>'
                        href="#">
                        <%:"Delete".Localize() %></a>
                    <input name="Id" type="hidden" />
                    </form>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- Dialogs -->
    <div class="hide">
        <div class="dialog" id="shipping-dialog" title="Shipping">
         <div id="message-box-error" class="hide message-box error message-box-error">
            <p>
            </p>
        </div>
        <div id="message-box-info" class="hide message-box info message-box-info">
            <p>
            </p>
        </div>
            <div class="common-form">
                <form id="shipping-form" action="">
                <fieldset>
                    <legend></legend>
                    <table>
                        <tbody>
                            <tr>
                                <th>
                                    <label for="name">
                                        <%:"Name".Localize() %></label>
                                </th>
                                <td>
                                    <input type="text" name="Name" class="medium" />
                                    <input type=hidden name="Id"  />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
                <div class="table-container">
                    <table>
                        <caption>
                            <%:"Shipping rule".Localize() %></caption>
                        <thead>
                            <tr>
                                <th class="common">
                                    <%:"Min weight".Localize() %>
                                </th>
                                <th class="common">
                                    <%:"Max weight".Localize() %>
                                </th>
                                <th>
                                    <%:"Freight charges".Localize() %>
                                </th>
                                <th class="action">
                                    <%:"Remove".Localize() %>
                                </th>
                            </tr>
                        </thead>
                        <tbody id="shipping-rule-container">
                        </tbody>
                    </table>
                    <a class="o-icon add rule-add" href="#">
                        <%:"Add".Localize() %></a>
                </div>
                <div class="buttons">
                    <button type="submit">
                        <%:"Save".Localize() %></button>
                </div>
                </form>
            </div>
        </div>
    </div>
    <table id="shipping-rule-row" class="hide">
        <tbody>
            <tr class="template">
                <td>
                    <input type="text" name="From" class="mini rule-from" /><span><%:"KG".Localize() %></span>
                </td>
                <td>
                    <input type="text" name="To" class="mini rule-to" /><span><%:"KG".Localize() %></span>
                </td>
                <td>
                    <span></span><input name="Cost" type="text" class="mini rule-cost" />
                </td>
                <td class="action">
                    <a class="o-icon remove remove-link" message='<%= "Are you sure you want to delete this rule?".Localize() %>' href="#">
                        <%:"Remove".Localize() %></a>
                    <input type="hidden" name="Id" class="rule-id" />
                    <input type="hidden" name="ShippingCostRules.index" class="rule-index" />
                </td>
            </tr>
        </tbody>
    </table>
</asp:Content>
<asp:Content ContentPlaceHolderID="ScriptContent" ID="ScriptContent" runat="server">
    <script type="text/javascript">
        var shippings = <%= ViewData["shippings"] %>;

        var add_action = '<%= ViewData["add_action"] %>';
        var edit_action = '<%= ViewData["edit_action"] %>';


    </script>
    <%using (var loader = ClientLoader.RegisterInstance())
      {
          loader.Require("shipping.index.js");
      } %>
</asp:Content>
